package com.slfx.idgen.demo.idgen.config;


import com.slfx.idgen.demo.idgen.properties.CustomIdProperties;
import com.slfx.idgen.demo.idgen.properties.IdgenProperties;
import com.slfx.idgen.demo.idgen.customid.CustomIdClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
@ConditionalOnClass({RestTemplate.class})
@EnableConfigurationProperties({CustomIdProperties.class, IdgenProperties.class})
public class CustomIdAutoConfiguration {


    @Bean("customIdClient")
    public CustomIdClient customIdClient(CustomIdProperties customIdProperties, IdgenProperties idgenProperties) {
        return new CustomIdClient(customIdProperties, idgenProperties);
    }
}
